home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / tcl / tcl67.lha / tcl6.7 / doc / TildeSubst.3 < prev    next >
Text File  |  1993-01-31  |  2KB  |  59 lines

  1. '\"
  2. '\" Copyright 1989 Regents of the University of California
  3. '\" Permission to use, copy, modify, and distribute this
  4. '\" documentation for any purpose and without fee is hereby
  5. '\" granted, provided that this notice appears in all copies.
  6. '\" The University of California makes no representations about
  7. '\" the suitability of this material for any purpose.  It is
  8. '\" provided "as is" without express or implied warranty.
  9. '\" 
  10. '\" $Header: /user6/ouster/tcl/man/RCS/TildeSubst.3,v 1.7 93/01/31 15:35:45 ouster Exp $ SPRITE (Berkeley)
  11. '\" 
  12. .so man.macros
  13. .HS Tcl_TildeSubst tcl
  14. .BS
  15. .SH NAME
  16. Tcl_TildeSubst \- replace tilde with home directory in a file name
  17. .SH SYNOPSIS
  18. .nf
  19. \fB#include <tcl.h>\fR
  20. .sp
  21. char *
  22. \fBTcl_TildeSubst\fR(\fIinterp\fR, \fIname\fR)
  23. .SH ARGUMENTS
  24. .AS Tcl_Interp *interp
  25. .AP Tcl_Interp *interp in
  26. Interpreter in which to report an error, if any.
  27. .AP char *name in
  28. File name, which may start with a ``~''.
  29. .BE
  30.  
  31. .SH DESCRIPTION
  32. .PP
  33. This utility procedure does tilde substition.  If \fIname\fR doesn't
  34. start with a ``~'' character, then the procedure returns \fIname\fR.
  35. If \fIname\fR does start with a tilde, then \fBTcl_TildeSubst\fR
  36. returns a new string identical to \fIname\fR except that the first
  37. element of \fIname\fR is replaced with the location of the home
  38. directory for the given user.  The substitution is carried out in
  39. the same way that it would be done by \fIcsh\fR.  If the tilde is
  40. followed immediately by a slash, then the \fB$HOME\fR environment
  41. variable is substituted.  Otherwise the characters between the
  42. tilde and the next slash are taken as a user name, which is
  43. looked up in the password file;  the user's home directory is
  44. retrieved from the password file and substituted.
  45. .PP
  46. The string returned by \fBTcl_TildeSubst\fR is a static string
  47. belonging to \fBTcl_TildeSubst\fR.  Its value will only persist
  48. until the next call to \fBTcl_TildeSubst\fR;  the caller should
  49. make a copy of the result if it needs to live a long time.
  50. .PP
  51. If an error occurs (e.g. because there was no user by the given
  52. name) then NULL is returned and an error message will be left
  53. at \fIinterp->result\fR.  It is assumed that \fIinterp->result\fR
  54. has been initialized in the standard way when \fBTcl_TildeSubst\fR
  55. is invoked.
  56.  
  57. .SH KEYWORDS
  58. file name, home directory, tilde, user
  59.